<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAppUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
	    Schema::create('app_users', function (Blueprint $table) {
		    $table->engine = 'InnoDB';
		    $table->increments('id');
		    $table->string('phone',11);
		    $table->string('email', 128);
		    $table->string('avatar',36)->nullable();
		    $table->string('password', 64)->nullable();
		    $table->string('nickname', 120)->nullable();
		    $table->string('verify_code', 4)->nullable();
		    $table->string('birthday', 10)->nullable();
		    $table->integer('corporation_id')->nullable();
		    $table->integer('organization_id')->nullable();
		    $table->string('position', 30)->nullable();
		    $table->timestamp('register_time')->nullableTimestamps();
		    $table->timestamp('last_login_time')->nullable();
		    $table->tinyInteger('status')->default(1);
		    $table->rememberToken();
		    $table->timestamps();

		    $table->unique('phone', 'app_users_phone_unique');

	    });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
	    Schema::drop('app_users');
    }
}
